USE [mbc]
GO
drop table [dbo].[RemittanceCashReceived];
/****** Object:  Table [dbo].[RemittanceCashReceived]    Script Date: 04/08/2014 12:00:23 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[RemittanceCashReceived](
	[ReceivedId] [bigint] NOT NULL,
	[ReceiptNo] [varchar](30) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ReceivedDate] [datetime] NOT NULL,
	[BranchId] [bigint] NOT NULL,
	[IssuedBranchId] [bigint] NOT NULL,
	[CreatedBy] [bigint] NOT NULL,
	[PaidCurrencyId] [bigint] NOT NULL,
	[RemitAmount] [decimal](18, 4) NOT NULL,
	[PaidAmount] [decimal](18, 4) NOT NULL,
	[ReceivedCurrenyId] [bigint] NOT NULL,
	[Remark] [nvarchar](255) NOT NULL,
	[ModifiedDate] [datetime] NOT NULL,
	[ModifiedBy] [bigint] NOT NULL,
	[ReceivedAmount] [decimal](18, 4) NOT NULL,
	[RefundAmount] [decimal](18, 4) NOT NULL,
	[ExtraFees] [decimal](18, 4) NOT NULL,
	[PaidBy] [bigint] NOT NULL,
	[AddCodeId] [bigint] NOT NULL,
	[Sender] [nvarchar](50) NOT NULL,
	[Receiver] [nvarchar](50) NOT NULL,
	[NRC] [nvarchar](50) NOT NULL,
	[Address] [nvarchar](255) NOT NULL,
	[Rate] [decimal](18, 4) NOT NULL,
	[RateOperator] [varchar](1) NOT NULL,
 CONSTRAINT [PK_RemittanceCashReceived] PRIMARY KEY CLUSTERED 
(
	[ReceivedId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[RemittanceCashReceived]  WITH CHECK ADD  CONSTRAINT [FK_RemittanceCashReceived_AddCode] FOREIGN KEY([AddCodeId])
REFERENCES [dbo].[AddCode] ([AddCodeId])
GO

ALTER TABLE [dbo].[RemittanceCashReceived] CHECK CONSTRAINT [FK_RemittanceCashReceived_AddCode]
GO

ALTER TABLE [dbo].[RemittanceCashReceived]  WITH CHECK ADD  CONSTRAINT [FK_RemittanceCashReceived_Branch] FOREIGN KEY([BranchId])
REFERENCES [dbo].[Branch] ([BranchId])
GO

ALTER TABLE [dbo].[RemittanceCashReceived] CHECK CONSTRAINT [FK_RemittanceCashReceived_Branch]
GO

ALTER TABLE [dbo].[RemittanceCashReceived]  WITH CHECK ADD  CONSTRAINT [FK_RemittanceCashReceived_Currency_Paid] FOREIGN KEY([PaidCurrencyId])
REFERENCES [dbo].[Currency] ([CurrencyId])
GO

ALTER TABLE [dbo].[RemittanceCashReceived] CHECK CONSTRAINT [FK_RemittanceCashReceived_Currency_Paid]
GO

ALTER TABLE [dbo].[RemittanceCashReceived]  WITH CHECK ADD  CONSTRAINT [FK_RemittanceCashReceived_Currency_Received] FOREIGN KEY([ReceivedCurrenyId])
REFERENCES [dbo].[Currency] ([CurrencyId])
GO

ALTER TABLE [dbo].[RemittanceCashReceived] CHECK CONSTRAINT [FK_RemittanceCashReceived_Currency_Received]
GO

ALTER TABLE [dbo].[RemittanceCashReceived]  WITH CHECK ADD  CONSTRAINT [FK_RemittanceCashReceived_User_CreatedBy] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[User] ([UserId])
GO

ALTER TABLE [dbo].[RemittanceCashReceived] CHECK CONSTRAINT [FK_RemittanceCashReceived_User_CreatedBy]
GO

ALTER TABLE [dbo].[RemittanceCashReceived]  WITH CHECK ADD  CONSTRAINT [FK_RemittanceCashReceived_User_ModifiedBy] FOREIGN KEY([ModifiedBy])
REFERENCES [dbo].[User] ([UserId])
GO

ALTER TABLE [dbo].[RemittanceCashReceived] CHECK CONSTRAINT [FK_RemittanceCashReceived_User_ModifiedBy]
GO


